package com.zy.edu.controller;


import com.zy.edu.bean.Classinfo;
import com.zy.edu.bean.InputParam;
import com.zy.edu.bean.School;
import com.zy.edu.service.SchoolService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author HuangHaiShui
 * @since 2021-07-13
 */
@RestController
@RequestMapping("/school")
public class SchoolController {
    @Resource
    SchoolService schoolService;

    /**
     * @Author: HuangHaiShui
     * @Description: 数据的新增与修改
     * @Date: 9:17 2021/7/14
     * @param school:
     * @return: Map
     **/
    @RequestMapping("/edit")
    public Map edit(@Valid School school){
        return schoolService.saveOrUpdate(school);
    }

    /**
     * @Author: HuangHaiShui
     * @Description:数据数据的查询，可分页可查全部
     * @Date: 9:17 2021/7/14
     * @param school:    name 模糊查询
     * @param inputParam:  分页条件
     * @return: Map
     **/
    @RequestMapping("/list")
    public Map list( School school, InputParam inputParam){

        return schoolService.list(school, inputParam);
    }


    /**
     * @Author: HuangHaiShui
     * @Description: 删除数据
     * @Date: 9:18 2021/7/14
     * @param school:  传入id 字段
     * @return: Map
     **/
    @RequestMapping("/dele")
    public Map dele( School school){
        return schoolService.dele(school);
    }


    @RequestMapping("/getById")
    public Map getById(School school, InputParam inputParam){

        return schoolService.getById(school, inputParam);
    }
    /**
     * @Author: HuangHaiShui 
     * @Description:三级联动，根据辖区查询校区
     * @Date: 9:31 2021/7/20
     * @param jurisId: 
     * @param userId:
     * @return: Map
     **/
    @RequestMapping("getByJurisId")
    public Map getByJurisId( String jurisId,String userId  ){

        return schoolService.getByJurisId(jurisId,userId);
    }

}

